using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataStructure
{
    public class SortedArray2Dictionary<Key, Value> : IDictionary<Key, Value> where Key : IComparable<Key>
    {
        private SortedArray2<Key, Value> array2;
        
        public SortedArray2Dictionary()
        {
            array2 = new SortedArray2<Key, Value>();
        }
        public SortedArray2Dictionary(int capacity)
        {
            array2 = new SortedArray2<Key, Value>(capacity);
        }
        public int Count =>array2.Count;
        public bool IsEmpty =>array2.IsEmpty;

        public void Add(Key key, Value value)
        {
            array2.Add(key, value);
        }

        public bool ContainsKey(Key key)
        {
            return array2.Contains(key);
        }

        public Value Get(Key key)
        {
            return array2.Get(key);
        }

        public void Remove(Key key)
        {
            array2.Remove(key);
        }

        public void Set(Key key, Value newValue)
        {
           array2.Add(key, newValue);
        }
    }
}